// client only
export default defineNuxtPlugin((nuxtApp) => {
  const { start, finish } = useMyLoadingStore();

  nuxtApp.hook("page:loading:start", () => {
    // console.log("page:loading:start");
    start();
  });
  nuxtApp.hook("page:loading:end", () => {
    // console.log("page:loading:end");
    finish();
  });
  nuxtApp.hook("vue:error", (err) => {
    console.log("vue:error", JSON.stringify(err));
  });
  // 第一次:
  // page:loading:start
  // page:finish
  // app:mounted
  // page:loading:end

  //  page:loading:start
  //  page:start
  //  page:loading:end
  //  page:finish
  //  page:loading:end --??
});
